App.require(function () {
    var app = App.getCurrent();

    app.defineComponent("str-table", {
        render: function (next) {
            this.computedData();
            this.fetch("./index.html", function (text) {
                next(this.renderHTML(text));
            });
        },
        getDomObj: function () {
            this.attachDom("table", "table");
        },
        computedData: function () {
            var property = this.property;
            property.class = property.class || "";
        },
        computedSlot: function (html) {
            var pattern = /<str-table[^>]*?>([\s\S]*?)<\/str-table>/g;
            var matches = pattern.exec(html);
            if (matches) return matches[1];
            return "";
        },
        get className() {
            return this.property.class;
        },
        set className(value) {
            if (this.property.class === value) return;
            this.domList.table.className = value;
            this.property.class = value;
        },
        get caption() {
            return this.domList.table.caption;
        },
        get tHead() {
            return this.domList.table.tHead;
        },
        get tFoot() {
            return this.domList.table.tFoot;
        },
        get rows() {
            return this.domList.table.rows;
        },
        get tBodies() {
            return this.domList.table.tBodies;
        },
        createTHead: function () {
            return this.domList.table.createTHead();
        },
        deleteTHead: function () {
            return this.domList.table.deleteTHead();
        },
        createTFoot: function () {
            return this.domList.table.createTFoot();
        },
        deleteTFoot: function () {
            return this.domList.table.deleteTFoot();
        },
        createCaption: function () {
            return this.domList.table.createCaption();
        },
        deleteCaption: function () {
            return this.domList.table.deleteCaption();
        },
        insertRow: function (index) {
            return this.domList.table.insertRow(index);
        },
        deleteRow: function (index) {
            return this.domList.table.deleteRow(index);
        }
    });
})